/*
 * @Author: zqx me_zqx@163.com
 * @Date: 2025-05-15 10:50:38
 * @LastEditors: zqx me_zqx@163.com
 * @LastEditTime: 2025-09-05 17:42:49
 * @FilePath: /XMate-h5/src/services/minutes/customer.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

import { http } from "@/utils/http";

// 获取销售配置
export const getSalesConfigAPI = () => {
    return http.request({
        url: `/rest/api/conference/sales/configure`,
        method: "GET",
        useOriginRes: true
    });
}

// 绑定客户 到 沟通信息上
export const bindCustomersAPI = (data: any) => {
    return http.request({
        url: `/rest/api/v1/communication/record`,
        method: "PUT",
        data,
        useOriginRes: true
    });
}

// 创建客户
export const createCustomerAPI = (data: any) => {
    return http.request({
        url: `/rest/api/customer`,
        method: "POST",
        data,
        useOriginRes: true
    });
  };

  /// 获取客户信息
export const getCustomCustomerInfoAPI = (customerId: string) => {
    return http.request({
        url: `/rest/api/customer/${customerId}`,
        method: "GET",
        useOriginRes: true
    });
  };

  export const getCustomerTypeAPI = () => {
    return http.request({
      url: `/rest/api/form/definition/fields?formCode=CUSTOMER_TPL`,
      method: "GET"
    });
  };
  
// 模糊查询内部参会人
export const searchInnerAttendAPI = (name: string) => {
    return http.request({
        url: `/rest/api/conference/user/search`,
        method: "POST",
        data: { name },
        useOriginRes: true
    });
}

// 搜索公司名称
export const searchCompanyAPI = (name: string) => {
    return http.request({
        url: `/rest/api/company/search`,
        method: "POST",
        data: { companyName: name },
        useOriginRes: true
    });
}

// 搜索公司名称 - 内部
export const searchInnerCompanyAPI = (name: string) => {
    return http.request({
        url: `/rest/api/customer/search`,
        method: "POST",
        data: { companyName: name },
        useOriginRes: true
    });
}


// 编辑客户
export const updateCustomerAPI = (customerId: string, data: any) => {
    return http.request({
        url: `/rest/api/customer/${customerId}`,
        method: "PUT",
        useOriginRes: true
    });
  };



// 客户列表
export const searchCustomerListAPI = (searchText = "") => {
    return http.request({
      url: "/rest/api/customer/search",
      method: "POST",
      data: {
        companyName: searchText
      }
    });
  };
  